<?php
// +----------------------------------------------------------------------
// | CoreThink [ Simple Efficient Excellent ]
// +----------------------------------------------------------------------
// | Copyright (c) 2014 http://www.corethink.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: jry <598821125@qq.com> <http://www.corethink.cn>
// +----------------------------------------------------------------------
namespace Admin\Controller;
use Think\Controller;
/**
 * 系统配置控制器
 *
 */
class ShensuController extends AdminController{

    public function index($group = 1){

        //获取所有配置
        $map['sf_jy_status'] = array('EQ', '4'); //禁用和正常状态
        $data_list = D('UserPipeioder')->page(!empty($_GET["p"])?$_GET["p"]:1, C('ADMIN_PAGE_ROWS'))->where($map)->select();
        $page = new \Common\Util\Page(D('UserPipeioder')->where($map)->count(), C('ADMIN_PAGE_ROWS'));
        //使用Builder快速建立列表页面。
        $show = $page->show();
        $builder = new \Common\Builder\ListBuilder();
        $builder->setMetaTitle('申诉列表');
        $this->assign('sslist',$data_list);
        $this->assign('show',$show);
        $this->display();
    }
    public function chuFaDk(){
        $jy_hd=$_GET['jydh']; //获得双方交易号
        $data['dk_lbw_order_pipei']=$jy_hd; //构造打款人id查询
        $fk_hyid=D('UserPipeioder')->where($data)->getField('dk_lbw_vipid'); //拿到打款人会员id
        $datadk['id']=$fk_hyid; //构造打款人user表查询数据
        $dataup['status']=0;       //冻结账号
        D('User')->where($datadk)->save($dataup);//下达冻结指令
        $tuijian_id=D('User')->where($datadk)->getField('lbw_tuijianren'); //拿到打款人推荐人id
        $datacig_zd['name'] = "LBW_SJCFCS";    //获取提现最低金额设置
        $config_cfje = D('SystemConfig')->where($datacig_zd)->getField('value');//处罚金额设置值获取
        //下面对推荐人进行处罚
        $data_tj['id']=$tuijian_id;
        $tj_money=D('User')->where($data_tj)->getField('user_jt_money'); //拿到推荐人钱包金额
        $data_tjcf['user_jt_money']=$tj_money-$config_cfje;  //用钱包金额 减去处罚设置金额
        D('User')->where($data_tj)->save($data_tjcf);  //保存数据
        //下面开始清除打款会员交易订单数据放入抢单市场
        $data_cf_vip['jiaoyi_zt']=9;
        $datakk['lbw_vipid']=$fk_hyid;
        D('UserTemppipeiorder')->where($datakk)->save($data_cf_vip); //正在排队的所有订单进行冻结
        //对双方交易订单进行清洁转换为待抢单状态
        $data_cf['dk_lbw_vipid']='';
        $data_cf['dk_creattime']='';
        $data_cf['dk_odr_ordernumber']='';
        $data_cf['dk_dakuan_status']=0;
        $data_cf['dk_dakuan_img']='';
        $data_cf['fk_name']='';
        $data_cf['dk_bank_name']='';
        $data_cf['dk_bank_number']='';
        $data_cf['dk_alipay']='';
        $data_cf['dk_peiduifs']='';
        $data_cf['dk_sj_mobile']='';
        $data_cf['dk_my_mobile']='';
        $data_cf['fk_pingzheng_zt']=0;
        $data_cf['sk_pingzheng_zt']=0;
        $data_cf['sf_jy_status']=8;
        $data_cf['shensu_cl_zt']=1;
        $data_cf['lixi_if_fafang']=0;
        D('UserPipeioder')->where($data)->save($data_cf);
        $this->success('处罚成功');
    }
    public function chuFaSk(){
        $jy_hd=$_GET['jydh']; //获得双方交易号
        $data['dk_lbw_order_pipei']=$jy_hd; //构造打款人id查询
        $sk_hyid=D('UserPipeioder')->where($data)->getField('sk_lbw_vipid'); //拿到收款人会员id
        $datadk['id']=$sk_hyid; //构造打款人user表查询数据
        $dataup['status']=0;       //冻结账号
        D('User')->where($datadk)->save($dataup);//下达冻结指令
        $tuijian_id=D('User')->where($datadk)->getField('lbw_tuijianren'); //拿到收款人推荐人id
        $datacig_zd['name'] = "LBW_SJCFCS";    //获取提现最低金额设置
        $config_cfje = D('SystemConfig')->where($datacig_zd)->getField('value');//处罚金额设置值获取
        //下面对推荐人进行处罚
        $data_tj['id']=$tuijian_id;
        $tj_money=D('User')->where($data_tj)->getField('user_jt_money'); //拿到推荐人钱包金额
        $data_tjcf['user_jt_money']=$tj_money-$config_cfje;  //用钱包金额 减去处罚设置金额
        D('User')->where($data_tj)->save($data_tjcf);  //保存数据
        //下面开始清除打款会员交易订单数据放入抢单市场
        $data_cf_vip['jiaoyi_zt']=9;
        $datakk['lbw_vipid']=$sk_hyid;
        D('UserTempskorder')->where($datakk)->save($data_cf_vip); //正在排队的所有订单进行冻结
        //对双方交易订单进行清洁转换为待抢单状态
        $data_cf['sk_lbw_vipid']='';
        $data_cf['sk_money_total']='';
        $data_cf['sk_name']='';
        $data_cf['sk_skuan_status']=0;
        $data_cf['sk_lbw_order_pipei']='';
        $data_cf['sk_skuan_img']='';
        $data_cf['sk_bank_name']='';
        $data_cf['sk_bank_number']='';
        $data_cf['sk_alipay']='';
        $data_cf['sk_peiduifs']='';
        $data_cf['sk_sj_mobile']='';
        $data_cf['sk_my_mobile']='';
        $data_cf['fk_pingzheng_zt']=0;
        $data_cf['sk_pingzheng_zt']=0;
        $data_cf['sf_jy_status']=8;
        $data_cf['shensu_cl_zt']=2;
        $data_cf['lixi_if_fafang']=0;
        D('UserPipeioder')->where($data)->save($data_cf);
        $this->success('处罚成功');
    }
    public function chexiao(){
        $jy_hd=$_GET['jydh'];
        $data['dk_lbw_order_pipei']=$jy_hd; //构造订单id查询
        $data_cx['sf_jy_status']=0;
        D('UserPipeioder')->where($data)->save($data_cx);
        $this->success('投诉撤销成功');
    }
}